--[[
    author:ZYB
    time:2021-10-28 11:29:08
]]
local FOO = { _VERSION = "0.0.1" }
local string = string

--! @brief   将字符串拆分为数组
--! @param   str为字符串 sep为分隔符
--! @return  table
--! @example str="xx0 xx1 xx2" sep=" " return {xx0,xx1,xx2}
FOO.split = function(str, sep)
    local sep, fields = sep or " ", {}
    local pattern = string.format("([^%s]+)", sep)
    string.gsub(str,pattern, function(c) fields[#fields+1] = c end)
    return fields
end


return FOO